#include "StdAfx.h"
#include "voip_svc_impl.h"
#include "voip_driver.h"
#include "dll_object.h"

voip_svc_impl::voip_svc_impl()
{
	voip_driver_ = new voip_driver;
}

voip_svc_impl::~voip_svc_impl()
{
	if( voip_driver_ )
	{
		voip_driver_->fini();
		delete voip_driver_;
		voip_driver_ = NULL;
	}
}

bool 
voip_svc_impl::init()
{
	if( !this->voip_driver_->init() )
	{
		aot_log_error(AOT_LM_ERROR, "voip_driver_->init() failed");
		return false;
	}

	return true;
}

bool
voip_svc_impl::reg(const char* user_name, const char* passwd)
{
	return this->voip_driver_->reg(user_name, passwd);
}

bool
voip_svc_impl::unreg()
{
	return this->voip_driver_->unreg();
}

const char*
voip_svc_impl::call(const char* callee_nbr)
{
	return this->voip_driver_->call(callee_nbr);
}

bool
voip_svc_impl::accept(const char* callid)
{
	return this->voip_driver_->accept(callid);
}

bool
voip_svc_impl::reject(const char* callid)
{
	return this->voip_driver_->reject(callid);
}

bool
voip_svc_impl::answer(const char* callid)
{
	return this->voip_driver_->answer(callid);
}

bool
voip_svc_impl::hangup(const char* callid)
{
	return this->voip_driver_->hangup(callid);
}

bool
voip_svc_impl::hold(const char* callid)
{
	return this->voip_driver_->hold(callid);
}

bool
voip_svc_impl::unhold(const char* callid)
{
	return this->voip_driver_->unhold(callid);
}

bool
voip_svc_impl::record_start(const char* callid, const char* rec_file)
{
	return this->voip_driver_->record_start(callid, rec_file);
}

bool
voip_svc_impl::record_pause(const char* callid, bool is_paused)
{
	return this->voip_driver_->record_pause(callid, is_paused);
}

bool
voip_svc_impl::record_stop(const char* callid)
{
	return this->voip_driver_->record_stop(callid);
}

bool
voip_svc_impl::play_file_to_remote(const char* callid, const char* play_file, bool loop)
{
	return this->voip_driver_->play_file_to_remote(callid, play_file, loop);
}

bool
voip_svc_impl::stop_play_to_remote(const char* callid)
{
	return this->voip_driver_->stop_play_to_remote(callid);
}

bool
voip_svc_impl::start_3p_conf(const char* ch1_callid, const char* ch2_callid)
{
	return this->voip_driver_->start_3p_conf(ch1_callid, ch2_callid);
}

const char*
voip_svc_impl::invite_3p_conf(const char* ch1_callid, const char* callee_nbr)
{
	return this->voip_driver_->invite_3p_conf(ch1_callid, callee_nbr);
}

bool
voip_svc_impl::hangup_3p_conf(const char* callid)
{
	return this->voip_driver_->hangup_3p_conf(callid);
}

void
voip_svc_impl::set_wave_out_dev(const char* wave_out_dev /* = NULL */)
{
	return this->voip_driver_->set_wave_out_dev(wave_out_dev);
}

void
voip_svc_impl::set_wave_in_dev(const char* wave_in_dev /* = NULL */)
{
	return this->voip_driver_->set_wave_in_dev(wave_in_dev);
}

void
voip_svc_impl::agc_enable(int enable)
{
	return this->voip_driver_->agc_enable(enable);
}

/*
bool 
voip_svc_impl::putq(aot::im::iim_packet* pkt)
{
	if( NULL == pkt )
	{
		return false;
	}
	if( xy::err_code::e_ok != this->voip_driver_->putq(pkt) )
	{
		pkt->destroy();
		return false;
	}
	return true;
}
*/